<!--_meta 作为公共模版分离出去-->
{include file="common/_meta" /}
<title>添加管理员 - 管理员管理 </title>
<meta name="keywords" content="李志立，lizhilimaster@163.com">
<meta name="description" content="李志立，lizhilimaster@163.com">
</head>
<body>
	<article class="cl pd-20">
		<form action="" method="post" class="form form-horizontal" id="form-admin-add">
			<input type="hidden" name="id" id="" value="{$data.id}" />
			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>上级权限：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<span class="select-box" style="width:150px;">
						<select class="select" name="fid" size="1">
							<option value="0">顶级权限</option>
							{volist name="res" id="res"}
							<option value="{$res.id}" <?php if($data['id']==$res['id']){echo 'selected = "selected"' ;}?> >
								<?php if(isset($res['level'])){echo str_repeat("|--",$res['level']);}?>{$res.title}</option>
							{/volist}
						</select>
					</span>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>权限名称：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" value="{$data.title}" placeholder="" id="title" name="title">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>权限地址：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" autocomplete="off" value="{$data.name}" id="name" name="name">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2">备注：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<textarea cols="" rows="" id="mark" class="textarea" placeholder="说点什么...100个字符以内" dragonfly="true" onKeyUp="textlength()"></textarea>
					<p class="textarea-numberbar"><em class="textarea-length">{$data.mark|mb_strlen}</em>/100</p>
				</div>
			</div>
			<div class="row cl">
				<div class="col-xs-8 col-sm-9 col-xs-offset-3 col-sm-offset-2">
					<input id="tijiao" class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
				</div>
			</div>
		</form>
	</article>

	<!--_footer 作为公共模版分离出去-->
	{include file="common/_footer" /}
	<!--/_footer /作为公共模版分离出去-->

	<!--请在下方写此页面业务相关的脚本-->
	<script type="text/javascript" src="__MANAGE__lib/jquery.validation/1.14.0/jquery.validate.js"></script>
	<script type="text/javascript" src="__MANAGE__lib/jquery.validation/1.14.0/validate-methods.js"></script>
	<script type="text/javascript" src="__MANAGE__lib/jquery.validation/1.14.0/messages_zh.js"></script>
	<script type="text/javascript">
		$(function() {
			$('.skin-minimal input').iCheck({
				checkboxClass: 'icheckbox-blue',
				radioClass: 'iradio-blue',
				increaseArea: '20%'
			});
			$("input[type=\"submit\"]").on('click',function () {
				let wo=$("#form-admin-add").validate({
					rules: {
						username: {
							required: true,
							minlength: 4,
							maxlength: 16,
						},
						password: {
							required: true,
						},
						password2: {
							required: true,
							equalTo: "#password"
						},
						adminRole: {
							required: true,
						},
					}
				});
				if(wo.form()){
					setTimeout(()=>{
						$("input[type=\"submit\"]").addClass('disabled').attr("disabled",true);
					},1000)
					var index = layer.load(1, {
						shade: [0.1,'#fff'] //0.1透明度的白色背景
					});
					// 关闭当前界面
					// var index = parent.layer.getFrameIndex(window.name);
					// parent.layer.close(index);
				}
			});


		});


		function textlength(obj, max) {
			var nmb=$('#mark').val().length;
			if(nmb>100){
				$('#mark').css("background-color","orangered");
				$('#mark').val($('#mark').val().substr(0,100));
				$('.textarea-length').text(100);
			}else{
				$('#mark').css("background-color","white");
				$('.textarea-length').text(nmb);
			}
		}
	</script>
	<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
